<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box{
      width: 100px;
      height: 100px;
      background-color: red;
      position: relative;
    }
  </style>
  <!-- 运用定时器，让 div 一秒后移动 -->
</head>
<body>
  <div class="box">

  </div>
  <script>
    var div = document.querySelector('div')
    var flag = 0;
    setInterval(function(){
        flag += 10
        div.style.left = flag +'px'
      },1000)

    
  </script>
</body>
</html>